function initData(){
	$.getJSON("/rest/protectRiskAssment/getRiskLevels",function(result){
		drawSumBox(result);
	});
	$.getJSON("/rest/protectRiskAssment/getAllSecondaryAssmentCount", 
			function(result) {
		initInfo(result.sum);
		initPie('devicePie',result.protectionPieData);
		initPie('stationPie',result.stationPieData);
	});
}
function drawSumBox(sum){
	var div = $('#infoRow');
	div.html('');
	if(sum.length>0){
		var lg = Math.max(2, Math.floor(12/sum.length));
		for(var i=0;i<sum.length;i++){
			var s = sum[i];
			var g = lg;
			if(i == 0){
				g = lg+12-lg*sum.length;
			}
			div.append('<div class="col-lg-'+g+' col-xs-6">'
					+'<div class="small-box bg-green" style="background:'+s.color+' !important;">'
					+'<div class="inner">'
					+'<span style="font-size:38px;"><i class="fa fa-home" title="厂站"></i><span class="num" id="sumS'+i+'" style="margin-right:20px;">0</span>'
					+'<i class="fa fa-clone" title="二次设备"></i><span class="num" id="sumP'+i+'">0</span></span>'
					+'<p>'+s.name+'</p>'
					+'</div>'
					+'</div>'
					+'</div>');
		}
	}
}
function initInfo(sum){
	if(sum.length>0){
		for(var i=0;i<sum.length;i++){
			var s = sum[i];
			$('#sumS'+i).html(s.sValue);
			$('#sumP'+i).html(s.pValue);
		}
	}
}
function initPie(id,dataset){
	var pie = echarts.init(document.getElementById(id));
	var option = {
			tooltip: {
				trigger: 'item',
			},
			grid:{
				top:20,
				left:10
			},
			series: [
			         {
			        	 name:'风险等级',
			        	 type:'pie',
			        	 selectedMode: 'single',
			        	 radius: [0, '80%'],
			        	 minAngle:0.1,
			        	 data:dataset
			         }
			         ]
	};
	pie.setOption(option);
}